#ifndef SPRITE_H
#define SPRITE_H

#define D2DColor(clr) D2D1::ColorF(D2D1::ColorF::clr)

#include <d2d1.h>
#pragma comment(lib, "d2d1.lib")

class Sprite{
public:
	Sprite(ID2D1Bitmap* tex,int width,int height);
	~Sprite();
	void Render(D2D1_SIZE_F position, ID2D1HwndRenderTarget *render, FLOAT angle = 0, D2D1_POINT_2F center = D2D1::Point2F(0.0F,0.0F), ID2D1SolidColorBrush *pBrush = NULL );
	void Render(D2D1_MATRIX_3X2_F matrix, ID2D1HwndRenderTarget *render, ID2D1SolidColorBrush *pBrush = NULL );

	//Setters
	void SetAnimate(BOOL animate){ isAnimated = animate; }
	void SetLoop(BOOL loop){ isLoop = loop;}
	void SetAlpha(float _alpha){ alpha = _alpha;}
	void SetFrame(int frame){ currentFrame = frame; }
	void SetVisible(BOOL visible){ isVisible = visible; }

	//Getters
	D2D1_RECT_F GetBoundingBox(){ return boundingBox; }
	float	GetAlpha(){ return alpha; }
	int		GetFrame(int frame){ return currentFrame; }

public:
	BOOL isAnimated;
	BOOL isLoop;
	BOOL isVisible;
private:
	ID2D1Bitmap* texture;
	int  currentFrame;
	int  lastFrame;
	int  sWidth;
	int  sHeight;
	int  wFrames;
	int  hFrames;
	D2D1_RECT_F boundingBox;
	float alpha;
};

#endif;